import java.io.*;
import java.util.*;

public class Te {
    public static void main(String[] args) {
        ArrayList<Integer> arrayList = new ArrayList<>();
        for (int i = 0; i < 5; i++) arrayList.add(i);

        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            Integer x = (Integer) it.next();
            System.out.print(x + " ");
        }
    }
    public static void main1(String[] args) {
        try (OutputStream outputStream = new FileOutputStream("E:/test.txt");
             PrintWriter printWriter = new PrintWriter(outputStream)) {

            printWriter.println("hello");
            printWriter.println("world");
            printWriter.flush();

//            ArrayList<Integer> arrayList = new ArrayList<>();
//            while (scanner.hasNext()) {
//                String s = scanner.next();
//                arrayList.add(Integer.parseInt(s));
//            }
//
//            arrayList.sort((a, b) -> {
//                return b - a;
//            });
//
//            System.out.println("max值为"+arrayList.get(0));


        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
